//
// Created by jsjxsy on 2022/8/31.
//
#include <iostream>
using namespace std;
#include <vector>
#include <algorithm>
class MyPrint {
 public:
  void operator()(int value) {
    cout << value << " ";
  }
};
int main() {
  vector<int> v1 = {1, 2, 5, 4, 3, 6, 7, 8, 10, 9};
  sort(v1.begin(), v1.end(), less<int>());
  for_each(v1.begin(), v1.end(), MyPrint());
  cout << endl;
  sort(v1.begin(), v1.end(), greater<int>());
  for_each(v1.begin(), v1.end(), MyPrint());
  cout << endl;
  return 0;
}

